# Database Modelling


# ERD

Entity Relationship Diagrams

  • Lucidchard

# Entities

  • Entities - rows
  • Attributes -columns

image-20211011110518161

image-20211011110612176

# Relationships

Describe, how the elements interact with each other

# Cardinality

image-20211011110854614

Think: what is the minimum and maximum:

Zero or many:

image-20211011112435115

image-20211011112526269

image-20211011113408199

# Primary Key

Rules

  1. unique
  2. never changing
  3. never null
  • one PK per table

# Foreign Key

  • Foreign Key dont have to be uniqe, they can be repeated
  • There can be multiple Foreign Keys in one entity

image-20211011190514225

# Composite Primary Key

when 2 or more attributes are nescessary to uniquly idetify a record

# Rules:
  1. Use the fewest amout of attributes possible
  2. Don't use attributes that are apt to change

image-20211011190908384

# Bridge Table

image-20211011201811349

Breaks up the many-to-many relationship